package com.mks.demo.websocket;

import com.alibaba.fastjson.JSONArray;
import com.mks.demo.entity.WkTest;

import javax.websocket.EncodeException;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;
import java.util.List;

/**
 * @Description
 * @Author hailong <1105744725@qq.com>
 * @Version V1.0.0
 * @Since 1.0
 * @Date 2019/5/30 15:31
 */
public class ServerEncoder implements Encoder.Text<List<WkTest>> {

    @Override
    public String encode(List<WkTest> object) throws EncodeException {
        return JSONArray.toJSONString(object);
    }

    @Override
    public void init(EndpointConfig endpointConfig) {

    }

    @Override
    public void destroy() {

    }
}
